<template>
  <div>
    <el-card shadow="never" class="mb20">
      <define-form ref="defineForm" @search="handleRefresh" />
    </el-card>
    <el-card shadow="never">
      <define-modal @refresh="handleRefresh" ref="defineModal" />
      <el-tooltip class="item" effect="dark" content="新增项目定义" placement="top">
        <el-button
          size="small"
          type="primary"
          class="fr mb20"
          v-if="$auth('satisfaction:add')"
          @click="handleEdit(false, {})"
          icon="el-icon-plus"
        />
      </el-tooltip>
      <define-table @edit="handleEdit" ref="defineTable" />
    </el-card>
  </div>
</template>

<script>
import DefineTable from './DefineTable'
import DefineModal from './DefineModal'
import DefineForm from './DefineForm'

export default {
  components: {
    DefineTable,
    DefineModal,
    DefineForm
  },
  methods: {
    handleEdit(bool, obj) {
      this.$refs.defineModal.edit(bool, obj)
    },
    handleRefresh(param = {}) {
      this.$refs.defineTable.handleGetList(param)
    }
  }
}
</script>
